# -*- coding: utf-8 -*-

from django.db import models
import django.utils.timezone as timezone
from DjangoUeditor.models import UEditorField

  
class Blog(models.Model):
    '''博客信息
    
    '''
    title = models.CharField("标题", max_length=200)
    display = models.BooleanField("显示", default=True)
    cover = models.ImageField(upload_to="blog/images/", verbose_name="封面", null=True, blank=True)
    category = models.CharField("类型", max_length=20, null=True, blank=True)
    content = UEditorField(verbose_name="内容", width=1200, height=480, toolbars="full", imagePath="blog/images/", filePath="files/", upload_settings={"imageMaxSize":1204000}, null=True, blank=True)
    #date = models.DateTimeField("发布日期", auto_now_add=True)
    date = models.DateTimeField("发布日期", default=timezone.now)

    class Meta:
        verbose_name = "博客信息"
        verbose_name_plural = verbose_name
        ordering = ['category', 'date']

    def __str__(self):
        return self.title
    

    
    
    

 

    
    